<template>
  <div class="container">
    <el-card class="data-view p10">
      <div class="title">
        <i class="el-icon-s-data"></i>
        <span>今日数据</span>
      </div>
      <div class="info">
        <div class="item">
          <div class="count">
            <div class="number">{{data.deliveryCountToday || 0}}</div>
            <div class="yesterday">较昨日{{data.deliveryCountToday - data.deliveryCountLastDay}}</div>
          </div>
          <div class="item-title">投递人数</div>
        </div>
        <!-- <div class="item">
          <div class="count">
            <div class="number">{{data.viewCountToday || 0}}</div>
            <div class="yesterday">较昨日{{data.viewCountToday - data.viewCountLastDay}}</div>
          </div>
          <div class="item-title">邀约面试</div>
        </div> -->
        <div class="item">
          <div class="count">
            <div class="number">{{data.useCountToday || 0}}</div>
            <div class="yesterday">较昨日{{data.useCountToday - data.useCountLastDay}}</div>
          </div>
          <div class="item-title">录用人数</div>
        </div>
        <div class="item">
          <div class="count">
            <div class="number">{{data.entryCountToday || 0}}</div>
            <div class="yesterday">较昨日{{data.entryCountToday - data.entryCountLastDay}}</div>
          </div>
          <div class="item-title">入职人数</div>
        </div>
      </div>
    </el-card>

    <el-card class="echart-view p10 mt15">
      <div class="title">
        <i class="el-icon-s-marketing"></i>
        <span>人才分析</span>
      </div>
      <bar-chart class="mt30" ref="barChart" style="width:100%"/>
    </el-card>
  </div>
</template>

<script>
import BarChart from "./BarChart";
import { dataList } from "@/api/special-session";
export default {
  components: { BarChart },
  props: {
    // 专场id
    specialSessionId: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
        data:{},
        init: true
    };
  },
  // 方法
  methods: {
    initView(){
      console.log(111)
      if(this.init){
        dataList({
          ssId: this.specialSessionId,
        }).then((res) => {
          let data = res.result;
          this.data = data;
          let title = ["博士","MBA/EMBA","硕士","本科", "大专", "中专/中技", "高中", "初中及以下"];
          let vals = [
            data.doctorCount || 0,
            data.mbaCount || 0,
            data.masterCount || 0,
            data.undergraduateCount || 0,
            data.juniorCollegeCount || 0,
            data.secondaryCount || 0,
            data.highSchoolCount || 0,
            data.middleSchoolCount || 0,
          ];
          this.init = false;
          this.$refs.barChart.initChart(title, vals);
        });
      }
    }
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    
  },
  // 销毁
  destroyed() {},
};
</script>
<style lang="scss" scoped>
.container {
  .data-view {
    .info {
      margin-top: 30px;
      .item {
        width: 33.33%;
        display: inline-block;
        text-align: center;
        position: relative;
        .count {
          margin-bottom: 6px;
          .number {
            font-size: 30px;
            font-weight: 400;
            color: #333333;
          }
          .yesterday {
            font-size: 12px;
            font-weight: 400;
            color: #348ce8;
            position: absolute;
            left: 50%;
            top: 0;
            margin-left: 20px;
          }
        }

        .item-title {
          font-size: 14px;
          font-weight: 400;
          color: #666666;
        }
      }
    }
  }

  .data-view,
  .echart-view {
    .title {
      i {
        font-size: 15px;
        color: #348ce8;
        margin-right: 5px;
        line-height: 16px;
      }
      span {
        font-size: 16px;
        font-weight: bold;
        color: #333333;
        line-height: 16px;
      }
    }
  }
}
</style>